<?php

/**
 * @author 
 * @copyright 2009
 */

$components = dirlist('../components');
for($i = 0; !empty($components[$i]); $i++){
	
	if(is_file('..'.DIR_SEP.'components'.DIR_SEP.$components[$i].DIR_SEP.'admin'.DIR_SEP.'icon.png')){
        $icon = '..'.DIR_SEP.'components'.DIR_SEP.$components[$i].DIR_SEP.'admin'.DIR_SEP.'icon.png';
	}else{
		$icon = '.'.DIR_SEP.'components'.DIR_SEP.'com_components'.DIR_SEP.'none.png';
	}
	
	if(is_file('..'.DIR_SEP.'components'.DIR_SEP.$components[$i].DIR_SEP.'info.xml')){

    	$xml = simplexml_load_file('..'.DIR_SEP.'components'.DIR_SEP.$components[$i].DIR_SEP.'info.xml');
    	$name = (string)$xml->info[0]->name;
    	$version = (string)$xml->info[0]->version;
    	$description = 'title="'.(string)$xml->info[0]->description.'   v.'.$version.'"';
	}else{
		$name = $components[$i];
		$version = 'unknown';
	}
	
	$component = explode('_', $components[$i]);
	
	echo "\n".'<li><a href="index.php?p=components&amp;name='.$component[1].'" '.$description.' ><img src="'.$icon.'" alt="" /> '.$name.'</a></li>'."\n";
}

?>